package bll

import (
	"context"
	"github.com/LyricTian/gin-admin/v7/internal/app/schema"
)

func (a *GroupHome) GetGroupVoice(ctx context.Context, params schema.GroupHomeQueryParam) (*schema.VideoQueryResult, error) {
	list, err := a.GroupHomeModel.GetGroupVoice(ctx, params)
	if err != nil {
		return nil, err
	}
	for _, data := range list.Data {
		data.Like, data.Favorite = a.LikeModel.GetLikeNum(ctx, data.ID, 1)
		data.IsLike = a.LikeModel.IsLike(ctx, data.ID, 1)
		info, err := a.UserInfoModel.Get(ctx, data.Creator)
		if err != nil {
			continue
		}
		data.UserInfo = info
	}

	return list, nil

}
